package top.lixunda.ecommerce.server.good.api.entity.db;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;
import java.time.LocalDateTime;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import top.lixunda.ecommerce.server.business.api.entity.BusinessConstants;

/**
 * <p>
 * 七牛云对象存储文件上传回调数据
 * </p>
 *
 * @author Xumda
 * @since 2020-01-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("qi_niu_file")
@ApiModel(value = "QiNiuFileDO对象", description = "七牛云对象存储文件上传回调数据")
public class QiNiuFileDO extends Model<QiNiuFileDO> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户类型，普通用户
     */
    public static final String USER_TYPE_USER = BusinessConstants.USER_TYPE_USER;

    /**
     * 用户类型，店铺用户
     */
    public static final String USER_TYPE_STORE = BusinessConstants.USER_TYPE_STORE;

    /**
     * 用户类型，官方管理员
     */
    public static final String USER_TYPE_ADMIN = BusinessConstants.USER_TYPE_ADMIN;

    @ApiModelProperty(value = "自动增长主键id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户id")
    @TableField("userId")
    private Integer userId;

    @ApiModelProperty(value = "用户类型，如用户，店铺，管理员")
    @TableField("user_type")
    private String userType;

    @ApiModelProperty(value = "获得文件保存在空间中的资源名。")
    @TableField("file_key")
    private String fileKey;

    @ApiModelProperty(value = "获得上传的目标空间名。")
    @TableField("bucket")
    private String bucket;

    @ApiModelProperty(value = "文件上传成功后的 HTTPETag。若上传时未指定资源ID，Etag将作为资源ID使用。")
    @TableField("etag")
    private String etag;

    @ApiModelProperty(value = "上传的原始文件名。")
    @TableField("fname")
    private String fname;

    @ApiModelProperty(value = "资源尺寸，单位为字节。")
    @TableField("fsize")
    private Double fsize;

    @ApiModelProperty(value = "资源类型，例如JPG图片的资源类型为image/jpg。")
    @TableField("mimeType")
    private String mimeType;

    @ApiModelProperty(value = "上传资源的后缀名，通过自动检测的 mimeType 或者$(fname)的后缀来获取。")
    @TableField("ext")
    private String ext;

    @ApiModelProperty(value = "$(fname) 忽略 $(ext) 的文件名。")
    @TableField("fprefix")
    private String fprefix;

    @ApiModelProperty(value = "hash")
    @TableField("hash")
    private String hash;

    @ApiModelProperty(value = "自定义参数1")
    @TableField("param1")
    private String param1;

    @ApiModelProperty(value = "自定义参数2")
    @TableField("param2")
    private String param2;

    @ApiModelProperty(value = "自定义参数3")
    @TableField("param3")
    private String param3;

    @ApiModelProperty(value = "创建时间")
    @TableField("createTime")
    private LocalDateTime createTime;


    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
